<template>
  <div class="house-detail-container">
    <!-- 背景装饰元素 -->
    <div class="background-decoration">
      <!-- 精美的动态背景 -->
      <div class="dynamic-background">
        <div class="building building-1"></div>
        <div class="building building-2"></div>
        <div class="building building-3"></div>
        <div class="building building-4"></div>
        <div class="building building-5"></div>
        <div class="cloud cloud-1"></div>
        <div class="cloud cloud-2"></div>
        <div class="cloud cloud-3"></div>
        <div class="sun"></div>
        <div class="light-ray ray-1"></div>
        <div class="light-ray ray-2"></div>
        <div class="light-ray ray-3"></div>
      </div>

      <!-- 浮动装饰元素 -->
      <div class="floating-shape shape-1"></div>
      <div class="floating-shape shape-2"></div>
      <div class="floating-shape shape-3"></div>
      <div class="floating-shape shape-4"></div>
      <div class="floating-shape shape-5"></div>
      <div class="floating-shape shape-6"></div>
    </div>

    <div class="detail-wrapper">
      <!-- 返回按钮 -->
      <div class="back-button">
        <el-button @click="goBack" icon="ArrowLeft">返回</el-button>
      </div>

      <div class="detail-content">
        <!-- 房源图片展示区域 -->
        <div class="image-section">
          <div class="main-image">
            <img :src="houseDetail.image" :alt="houseDetail.title">
          </div>
          <div class="thumbnail-images">
            <div
                class="thumbnail"
                v-for="(image, index) in houseDetail.images"
                :key="index"
                :class="{ active: index === activeImageIndex }"
                @click="activeImageIndex = index"
            >
              <img :src="image" :alt="`图片${index + 1}`">
            </div>
          </div>
        </div>

        <!-- 房源信息展示区域 -->
        <div class="info-section">
          <div class="house-header">
            <h1 class="house-title">{{ houseDetail.title }}</h1>
            <div class="house-price">¥{{ houseDetail.price }}<span>/月</span></div>
          </div>

          <div class="house-meta">
            <div class="meta-item">
              <el-icon><House /></el-icon>
              <span>{{ houseDetail.area }}㎡</span>
            </div>
            <div class="meta-item">
              <el-icon><Location /></el-icon>
              <span>{{ houseDetail.address }}</span>
            </div>
            <div class="meta-item">
              <el-icon><OfficeBuilding /></el-icon>
              <span>{{ houseDetail.floor }}</span>
            </div>
            <div class="meta-item">
              <el-icon><Sunny /></el-icon>
              <span>{{ houseDetail.orientation }}</span>
            </div>
          </div>

          <div class="house-features">
            <div class="feature-item">
              <span class="label">户型:</span>
              <span class="value">{{ houseDetail.layout }}</span>
            </div>
            <div class="feature-item">
              <span class="label">装修:</span>
              <span class="value">{{ houseDetail.decoration }}</span>
            </div>
            <div class="feature-item">
              <span class="label">类型:</span>
              <span class="value">{{ houseDetail.type }}</span>
            </div>
            <div class="feature-item">
              <span class="label">出租方式:</span>
              <span class="value">{{ houseDetail.rentType }}</span>
            </div>
          </div>

          <div class="house-tags">
            <el-tag
                v-for="tag in houseDetail.tags"
                :key="tag"
                size="small"
                :type="getTagType(tag)"
            >
              {{ tag }}
            </el-tag>
          </div>

          <div class="house-description">
            <h3>房源描述</h3>
            <p>{{ houseDetail.description }}</p>
          </div>

          <div class="house-facilities">
            <h3>配套设施</h3>
            <div class="facilities-list">
              <div
                  class="facility-item"
                  v-for="facility in houseDetail.facilities"
                  :key="facility"
                  :class="{ available: houseDetail.availableFacilities.includes(facility) }"
              >
                <el-icon>
                  <Check v-if="houseDetail.availableFacilities.includes(facility)" />
                  <Close v-else />
                </el-icon>
                <span>{{ facility }}</span>
              </div>
            </div>
          </div>

          <div class="action-buttons">
            <el-button type="primary" size="large" @click="contactLandlord">
              联系房东
            </el-button>
            <el-button
                type="success"
                size="large"
                @click="applyForAgency"
                id="applyAgencyBtn"
            >
              申请代理
            </el-button>
            <el-button
                :type="houseDetail.favorited ? 'danger' : 'default'"
                size="large"
                @click="toggleFavorite"
            >
              <el-icon><Star v-if="houseDetail.favorited" /></el-icon>
              {{ houseDetail.favorited ? '已收藏' : '收藏房源' }}
            </el-button>
          </div>
        </div>
      </div>

      <!-- 房东信息区域 -->
      <div class="landlord-section">
        <div class="landlord-card">
          <div class="landlord-header">
            <el-avatar :size="60" :src="houseDetail.landlord.avatar" />
            <div class="landlord-info">
              <h3>{{ houseDetail.landlord.name }}</h3>
              <p>房东身份已认证</p>
            </div>
          </div>

          <div class="landlord-contact-info">
            <div class="contact-item">
              <el-icon><Phone /></el-icon>
              <span>{{ houseDetail.landlord.phone }}</span>
            </div>
          </div>

          <div class="landlord-stats">
            <div class="stat-item">
              <div class="stat-value">{{ houseDetail.landlord.listings }}</div>
              <div class="stat-label">房源数</div>
            </div>
            <div class="stat-item">
              <div class="stat-value">{{ houseDetail.landlord.rented }}</div>
              <div class="stat-label">已出租</div>
            </div>
            <div class="stat-item">
              <div class="stat-value">{{ houseDetail.landlord.rating }}</div>
              <div class="stat-label">评分</div>
            </div>
          </div>

          <div class="landlord-contact">
            <el-button type="primary" @click="contactLandlord">
              <el-icon><ChatLineSquare /></el-icon>
              联系房东
            </el-button>
          </div>
        </div>
      </div>
    </div>

    <!-- 申请代理对话框 -->
    <el-dialog
      v-model="showApplyDialog"
      title="申请代理"
      width="500px"
      :before-close="handleApplyClose"
    >
      <el-form
        ref="applyFormRef"
        :model="applyForm"
        :rules="applyRules"
        label-width="100px"
      >
        <el-form-item label="申请理由" prop="reason">
          <el-input
            v-model="applyForm.reason"
            type="textarea"
            :rows="4"
            placeholder="请说明申请代理此房源的理由"
          />
        </el-form-item>

        <el-form-item label="联系电话" prop="contactPhone">
          <el-input
            v-model="applyForm.contactPhone"
            placeholder="请输入您的联系电话"
          />
        </el-form-item>

        <el-form-item label="微信号" prop="wechat">
          <el-input
            v-model="applyForm.wechat"
            placeholder="请输入您的微信号（可选）"
          />
        </el-form-item>
      </el-form>

      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary" @click="submitApplication">提交申请</el-button>
          <el-button @click="showApplyDialog = false">取消</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
  House,
  Location,
  OfficeBuilding,
  Sunny,
  Check,
  Close,
  Star,
  ChatLineSquare,
  ArrowLeft,
  Phone
} from '@element-plus/icons-vue'

const route = useRoute()
const router = useRouter()

// 当前选中的图片索引
const activeImageIndex = ref(0)
const showApplyDialog = ref(false)
const applyFormRef = ref()

// 申请代理表单
const applyForm = ref({
  reason: '',
  contactPhone: '',
  wechat: ''
})

// 申请代理表单验证规则
const applyRules = {
  reason: [
    { required: true, message: '请输入申请理由', trigger: 'blur' }
  ],
  contactPhone: [
    { required: true, message: '请输入联系电话', trigger: 'blur' },
    { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
  ]
}

// 房源详情数据
const houseDetail = ref({
  id: 1,
  title: '精致一居室公寓',
  price: 4500,
  area: 60,
  address: '北京市朝阳区CBD建国路123号',
  floor: '5/18层',
  orientation: '南北',
  layout: '一室一厅',
  decoration: '精装修',
  type: '公寓',
  rentType: '房东直租',
  description: '位于北京市朝阳区核心地段，交通便利，周边配套设施齐全。房屋为全新装修，家具家电齐全，可直接拎包入住。小区环境优美，24小时安保，是您居住的理想选择。',
  image: 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1769&q=80',
  images: [
    'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1769&q=80',
    'https://images.unsplash.com/photo-1600585154340-be6161a56a0c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80',
    'https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80',
    'https://images.unsplash.com/photo-1575517114892-6a0eb8c4fd5d?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80'
  ],
  tags: ['近地铁', '精装修', '拎包入住', '新上架'],
  facilities: [
    '冰箱', '床', '洗衣机', '热水器', 'WIFI', '沙发',
    '厨房', '油烟机', '燃气灶', '电视', '空调', '衣柜',
    '智能门锁', '阳台', '暖气', '橱柜', '餐桌'
  ],
  availableFacilities: [
    '冰箱', '床', '洗衣机', '热水器', 'WIFI', '沙发',
    '厨房', '油烟机', '燃气灶', '电视', '空调', '衣柜',
    '智能门锁', '阳台', '暖气'
  ],
  favorited: false,
  landlord: {
    id: 101,
    name: '张三',
    avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
    listings: 5,
    rented: 3,
    rating: 4.8,
    phone: '138****8888'
  }
})

// 获取标签类型
const getTagType = (tag) => {
  const tagTypes = {
    '近地铁': 'success',
    '精装修': 'warning',
    '拎包入住': 'info',
    '新上架': 'danger',
    '学区房': 'primary',
    '地铁房': 'success',
    '别墅': 'primary',
    '带花园': 'success',
    '独栋': 'warning'
  }
  return tagTypes[tag] || 'info'
}

// 返回上一页
const goBack = () => {
  router.go(-1)
}

// 联系房东
const contactLandlord = () => {
  // 跳转到与房东的聊天页面
  router.push(`/message/chat/${houseDetail.value.landlord.id}`)
}

// 申请代理
const applyForAgency = () => {
  // 初始化表单数据
  applyForm.value = {
    reason: '',
    contactPhone: '',
    wechat: ''
  }
  showApplyDialog.value = true
}

// 关闭申请对话框前的处理
const handleApplyClose = (done) => {
  ElMessageBox.confirm('确认关闭申请代理页面吗？')
    .then(() => {
      done()
    })
    .catch(() => {
      // 取消关闭
    })
}

// 提交申请
const submitApplication = async () => {
  try {
    const valid = await applyFormRef.value.validate()
    if (valid) {
      const response = await fetch('/api/agent/application/apply', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'info': localStorage.getItem('token') || ''
        },
        body: JSON.stringify({
          houseId: houseDetail.value.id,
          reason: applyForm.value.reason,
          contactPhone: applyForm.value.contactPhone,
          wechat: applyForm.value.wechat
        })
      })

      const result = await response.json()

      if (result.code === 200) {
        ElMessage.success('申请已提交，请等待房东审核')
        showApplyDialog.value = false
        // 可以跳转到申请状态页面
        // router.push('/agent/applications')
      } else {
        ElMessage.error(result.message || '申请提交失败')
      }
    }
  } catch (error) {
    console.error('提交申请失败:', error)
    ElMessage.error('申请提交失败')
  }
}

// 切换收藏状态
const toggleFavorite = () => {
  houseDetail.value.favorited = !houseDetail.value.favorited
  ElMessage.success(houseDetail.value.favorited ? '已收藏' : '已取消收藏')
}

// 获取房源详情
const fetchHouseDetail = async (houseId) => {
  try {
    const response = await fetch(`/api/house/${houseId}`, {
      headers: {
        'info': localStorage.getItem('token') || ''
      }
    })
    const result = await response.json()

    if (result.code === 200 && result.data) {
      const house = result.data.data
      // 更新房源详情数据
      houseDetail.value = {
        id: house.houseId,
        title: house.houseTitle || house.houseSummary || '房源详情',
        price: house.rent,
        area: house.area,
        address: house.houseLocation,
        floor: house.floor,
        orientation: house.orientation,
        layout: house.layout,
        decoration: '精装修', // 默认值
        type: house.houseRentType === 1 ? '房东直租' : '中介代理',
        rentType: house.houseRentType === 1 ? '房东直租' : '中介代理',
        description: house.houseSummary || '暂无描述',
        image: house.houseMedia?.picPath1 || 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1769&q=80',
        images: [
          house.houseMedia?.picPath1,
          house.houseMedia?.picPath2,
          house.houseMedia?.picPath3,
          house.houseMedia?.picPath4,
          house.houseMedia?.picPath5
        ].filter(Boolean),
        tags: ['近地铁', '精装修', '拎包入住'],
        facilities: [
          '冰箱', '床', '洗衣机', '热水器', 'WIFI', '沙发',
          '厨房', '油烟机', '燃气灶', '电视', '空调', '衣柜'
        ],
        availableFacilities: [
          '冰箱', '床', '洗衣机', '热水器', 'WIFI', '沙发',
          '厨房', '油烟机', '燃气灶', '电视', '空调'
        ],
        favorited: false,
        landlord: {
          id: house.landlord?.landlordId || 101,
          name: house.landlord?.landlordName || '房东',
          avatar: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
          listings: 5,
          rented: 3,
          rating: 4.8,
          phone: house.phone || '138****8888'
        }
      }
    } else {
      ElMessage.error('获取房源详情失败')
    }
  } catch (error) {
    console.error('获取房源详情失败:', error)
    ElMessage.error('获取房源详情失败')
  }
}

// 页面加载时的处理
onMounted(async () => {
  // 获取房源ID并请求详细信息
  const houseId = route.params.id
  console.log('房源ID:', houseId)

  if (houseId) {
    await fetchHouseDetail(houseId)
  }

  // 从localStorage获取用户信息
  const user = localStorage.getItem('user')
  if (user) {
    try {
      const userData = JSON.parse(user)
      // 初始化表单中的联系电话为用户电话
      if (userData.phone) {
        applyForm.value.contactPhone = userData.phone
      }
    } catch (e) {
      console.error('解析用户信息失败', e)
    }
  }
})
</script>

<style scoped>
.house-detail-container {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

.background-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

/* 精美的动态背景 */
.dynamic-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, #1a2980, #26d0ce);
  overflow: hidden;
}

/* 建筑物 */
.building {
  position: absolute;
  bottom: 0;
  background: rgba(30, 30, 50, 0.8);
  border-radius: 5px 5px 0 0;
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.building-1 {
  left: 10%;
  width: 80px;
  height: 300px;
  animation: buildingGlow 4s infinite alternate;
}

.building-2 {
  left: 25%;
  width: 120px;
  height: 400px;
  animation: buildingGlow 5s infinite alternate-reverse;
}

.building-3 {
  left: 45%;
  width: 100px;
  height: 350px;
  animation: buildingGlow 6s infinite alternate;
}

.building-4 {
  left: 65%;
  width: 140px;
  height: 450px;
  animation: buildingGlow 4.5s infinite alternate-reverse;
}

.building-5 {
  left: 80%;
  width: 90px;
  height: 320px;
  animation: buildingGlow 5.5s infinite alternate;
}

@keyframes buildingGlow {
  0% {
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
  }
  100% {
    box-shadow: 0 -5px 25px rgba(100, 200, 255, 0.6);
  }
}

/* 云朵 */
.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  filter: blur(2px);
}

.cloud-1 {
  top: 20%;
  left: 5%;
  width: 80px;
  height: 30px;
  animation: cloudMove 25s linear infinite;
}

.cloud-2 {
  top: 35%;
  left: 70%;
  width: 120px;
  height: 40px;
  animation: cloudMove 30s linear infinite;
}

.cloud-3 {
  top: 15%;
  left: 40%;
  width: 100px;
  height: 35px;
  animation: cloudMove 35s linear infinite;
}

@keyframes cloudMove {
  0% {
    transform: translateX(-100px);
  }
  100% {
    transform: translateX(calc(100vw + 100px));
  }
}

/* 太阳 */
.sun {
  position: absolute;
  top: 80px;
  right: 100px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #ffeb3b, #ffc107);
  border-radius: 50%;
  box-shadow: 0 0 40px #ff9800, 0 0 80px #ff5722;
  animation: sunPulse 3s infinite alternate;
}

@keyframes sunPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 40px #ff9800, 0 0 80px #ff5722;
  }
  100% {
    transform: scale(1.1);
    box-shadow: 0 0 60px #ff9800, 0 0 100px #ff5722;
  }
}

/* 光线 */
.light-ray {
  position: absolute;
  top: 120px;
  right: 140px;
  width: 400px;
  height: 200px;
  background: linear-gradient(to right, transparent, rgba(255, 235, 59, 0.2), transparent);
  transform-origin: left center;
  animation: rayRotate 10s infinite linear;
}

.ray-1 {
  transform: rotate(0deg);
  animation-delay: 0s;
}

.ray-2 {
  transform: rotate(60deg);
  animation-delay: 2s;
}

.ray-3 {
  transform: rotate(120deg);
  animation-delay: 4s;
}

@keyframes rayRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 浮动装饰元素 */
.floating-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  animation: float 15s infinite linear;
}

.shape-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -100px;
  animation-duration: 20s;
  background: radial-gradient(circle, rgba(74, 144, 226, 0.2) 0%, transparent 70%);
}

.shape-2 {
  width: 200px;
  height: 200px;
  bottom: -80px;
  right: -80px;
  animation-duration: 25s;
  animation-direction: reverse;
  background: radial-gradient(circle, rgba(255, 107, 107, 0.2) 0%, transparent 70%);
}

.shape-3 {
  width: 150px;
  height: 150px;
  top: 30%;
  right: 20%;
  animation-duration: 15s;
  background: radial-gradient(circle, rgba(80, 227, 194, 0.2) 0%, transparent 70%);
}

.shape-4 {
  width: 100px;
  height: 100px;
  bottom: 20%;
  left: 20%;
  animation-duration: 18s;
  animation-direction: reverse;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.2) 0%, transparent 70%);
}

.shape-5 {
  width: 250px;
  height: 250px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 22s;
  background: radial-gradient(circle, rgba(155, 89, 182, 0.2) 0%, transparent 70%);
}

.shape-6 {
  width: 180px;
  height: 180px;
  top: 70%;
  left: 10%;
  animation-duration: 28s;
  background: radial-gradient(circle, rgba(231, 76, 60, 0.2) 0%, transparent 70%);
}

@keyframes float {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(20px, 20px) rotate(90deg);
  }
  50% {
    transform: translate(0, 40px) rotate(180deg);
  }
  75% {
    transform: translate(-20px, 20px) rotate(270deg);
  }
  100% {
    transform: translate(0, 0) rotate(360deg);
  }
}

.detail-wrapper {
  width: 100%;
  max-width: 1400px;
  margin: 20px auto;
  z-index: 1;
  position: relative;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.back-button {
  margin-bottom: 10px;
}

.back-button .el-button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
}

.back-button .el-button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.detail-content {
  display: flex;
  gap: 30px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.image-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.main-image {
  height: 400px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.main-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-images {
  display: flex;
  gap: 15px;
  overflow-x: auto;
  padding: 5px;
}

.thumbnail {
  width: 100px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.thumbnail:hover,
.thumbnail.active {
  border-color: #409EFF;
  transform: translateY(-3px);
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.house-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.house-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
}

.house-price {
  font-size: 32px;
  font-weight: 700;
  color: #409EFF;
}

.house-price span {
  font-size: 16px;
  font-weight: normal;
}

.house-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 15px 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #7f8c8d;
}

.house-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.feature-item {
  display: flex;
  gap: 10px;
}

.feature-item .label {
  font-weight: 600;
  color: #2c3e50;
}

.feature-item .value {
  color: #7f8c8d;
}

.house-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 15px 0;
}

.house-description h3,
.house-facilities h3 {
  margin: 0 0 15px;
  font-size: 20px;
  color: #2c3e50;
}

.house-description p {
  margin: 0;
  line-height: 1.6;
  color: #7f8c8d;
}

.facilities-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.facility-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #7f8c8d;
}

.facility-item.available {
  color: #67C23A;
}

.facility-item .el-icon {
  font-size: 16px;
}

.action-buttons {
  display: flex;
  gap: 15px;
  padding-top: 20px;
  margin-top: auto;
}

.action-buttons .el-button {
  flex: 1;
}

.landlord-section {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.landlord-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.landlord-header {
  display: flex;
  align-items: center;
  gap: 20px;
}

.landlord-header h3 {
  margin: 0 0 5px;
  font-size: 20px;
  color: #2c3e50;
}

.landlord-header p {
  margin: 0;
  font-size: 14px;
  color: #7f8c8d;
  display: flex;
  align-items: center;
  gap: 5px;
}

.certified-icon {
  color: #67C23A;
}

.landlord-contact-info {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 15px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #7f8c8d;
}

.contact-item:last-child {
  margin-bottom: 0;
}

.landlord-stats {
  display: flex;
  justify-content: space-around;
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #409EFF;
}

.stat-label {
  font-size: 14px;
  color: #7f8c8d;
}

.landlord-contact .el-button {
  width: 100%;
  height: 45px;
  font-size: 16px;
}

/* 申请对话框样式 */
.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 992px) {
  .detail-content {
    flex-direction: column;
  }

  .house-header {
    flex-direction: column;
    gap: 15px;
  }

  .house-features,
  .facilities-list {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    flex-direction: column;
  }

  .landlord-stats {
    flex-direction: column;
    gap: 15px;
  }
}
</style>
